Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(render-engine): facade adds onCellPointerOver,onCellDragOver,onCellDrop #2240

Merged
merged 8 commits into from
May 22, 2024

Conversation

Dushusir
Copy link
Member

@Dushusir Dushusir commented May 14, 2024

如何测试?

分别在控制台粘贴以下代码测试 API,测试一个刷新一次页面

window.univerAPI.getSheetHooks().onCellPointerMove((cell) => {
    // 拿到当前鼠标指向的单元格
    console.log(cell?.location.row, cell?.location.col);
  })

鼠标hover在sheet区域,跟随鼠标移动触发

window.univerAPI.getSheetHooks().onCellPointerOver((cell) => {
    // 拿到当前鼠标指向的单元格
    console.log(cell?.location.row, cell?.location.col);
  })

鼠标hover在sheet区域,打中不同单元格时才触发

window.univerAPI.getSheetHooks().onCellDragOver((cell) => {
    // 拿到当前鼠标指向的单元格
    console.log(cell?.location.row, cell?.location.col);
  })

从外部拖拽一个可拖拽元素(比如本地记事本的文本)到sheet区域,打中不同单元格时触发

window.univerAPI.getSheetHooks().onCellDrop((cell) => {
    // 拿到当前鼠标指向的单元格
    console.log(cell?.location.row, cell?.location.col);
  })

从外部拖拽一个可拖拽元素(比如本地记事本的文本)到sheet区域,松开鼠标时触发

@Dushusir Dushusir changed the title feat(render-engine): add drag event listener,Facade add onCellPointer… feat(render-engine): facade add onCellPointerOver,onCellDragOver,onCellDrop May 14, 2024
@Dushusir Dushusir changed the title feat(render-engine): facade add onCellPointerOver,onCellDragOver,onCellDrop feat(render-engine): facade adds onCellPointerOver,onCellDragOver,onCellDrop May 14, 2024
Copy link

github-actions bot commented May 14, 2024

View Deployment

📑 Examples 📚 Storybook
🔗 Preview link 🔗 Preview link

Copy link

codecov bot commented May 14, 2024

Codecov Report

Attention: Patch coverage is 2.70270% with 288 lines in your changes are missing coverage. Please review.

Project coverage is 30.17%. Comparing base (7b411b3) to head (e64a146).

Files Patch % Lines
packages/engine-render/src/engine.ts 0.00% 68 Missing ⚠️
...ges/sheets-ui/src/services/drag-manager.service.ts 0.00% 51 Missing ⚠️
packages/engine-render/src/scene.input-manager.ts 0.00% 49 Missing ⚠️
...heets-ui/src/controllers/drag-render.controller.ts 0.00% 29 Missing ⚠️
packages/engine-render/src/base-object.ts 0.00% 28 Missing ⚠️
packages/engine-render/src/scene.ts 0.00% 28 Missing ⚠️
packages/sheets-ui/src/common/utils.ts 0.00% 19 Missing ⚠️
packages/engine-render/src/thin-scene.ts 0.00% 8 Missing ⚠️
...es/sheets-ui/src/services/hover-manager.service.ts 0.00% 7 Missing ⚠️
...formula/src/views/more-functions/MoreFunctions.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2240      +/-   ##
==========================================
- Coverage   30.28%   30.17%   -0.11%     
==========================================
  Files        1413     1415       +2     
  Lines       72270    72547     +277     
  Branches    15149    15198      +49     
==========================================
+ Hits        21886    21894       +8     
- Misses      50384    50653     +269     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Dushusir Dushusir added the qa:untested This PR is ready to be tested label May 20, 2024
@Dushusir Dushusir force-pushed the dushusir/cell-hooks branch 2 times, most recently from 981a541 to c630b06 Compare May 20, 2024 11:56
@Dushusir Dushusir marked this pull request as ready for review May 20, 2024 12:13
@univer-bot
Copy link

univer-bot bot commented May 20, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: feat(render-engine): facade adds onCellPointerOver,onCellDragOver,onCellDrop

Title: feat(render-engine): facade adds onCellPointerOver,onCellDragOver,onCellDrop


How to test?

Paste the following codes in the console to test the API and refresh the page each time.

window.univerAPI.getSheetHooks().onCellPointerMove((cell) => {
    // Get the cell currently pointed by the mouse
    console.log(cell?.location.row, cell?.location.col);
  })

When the mouse hovers in the sheet area, it is triggered following the mouse movement.

window.univerAPI.getSheetHooks().onCellPointerOver((cell) => {
    // Get the cell currently pointed by the mouse
    console.log(cell?.location.row, cell?.location.col);
  })

It is triggered when the mouse hovers in the sheet area and hits different cells.

window.univerAPI.getSheetHooks().onCellDragOver((cell) => {
    // Get the cell currently pointed by the mouse
    console.log(cell?.location.row, cell?.location.col);
  })

Drag a draggable element (such as local notepad text) from outside to the sheet area, and trigger when hitting different cells.

window.univerAPI.getSheetHooks().onCellDrop((cell) => {
    // Get the cell currently pointed by the mouse
    console.log(cell?.location.row, cell?.location.col);
  })

Drag a draggable element (such as local notepad text) from outside to the sheet area, and trigger when the mouse is released.

@zhaolixin7 zhaolixin7 added the qa:verified This PR has already by verified by a QA and is considered good enough to be merge label May 21, 2024
@univer-bot univer-bot bot removed the qa:untested This PR is ready to be tested label May 21, 2024
@Dushusir Dushusir merged commit 874fa27 into dev May 22, 2024
9 checks passed
@Dushusir Dushusir deleted the dushusir/cell-hooks branch May 22, 2024 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qa:verified This PR has already by verified by a QA and is considered good enough to be merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants